import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import Layout from '@/layout/Layout.vue'
export const permissionRoutes: RouteRecordRaw[] = [
    {
        path: "/user",
        component: Layout,
        redirect: '/user/index',
        name: "/user",
        meta: {
            icon: 'el-icon-location',
            title: '用户模块'
        },
        children: [
            {
                path: "index",
                name: "/user/index",
                component: () => import("@/view/user/index.vue"),
                // redirect: '/user/index/list',
                meta: {
                    icon: 'el-icon-location',
                    title: '用户首页'
                },
                children: []
            },
            {
                path: "info",
                name: "/user/info",
                component: () => import("@/view/user/info.vue"),
                meta: {
                    icon: 'el-icon-location',
                    title: '群组信息'
                },
                children: []
            }, {
                path: "friend",
                name: "/user/friend",
                component: () => import("@/view/user/friend.vue"),
                meta: {
                    icon: 'el-icon-location',
                    title: '联系人信息'
                },
                children: []
            }

        ]
    }
]
const routes: Array<RouteRecordRaw> = [
    {
        //路由初始指向
        path: '/',
        redirect: '/index',
    },
    {
        //路由初始指向
        path: '/index',
        name: 'index',
        component: () => import('@/view/index/index.vue'),
    },
    ...permissionRoutes
];

const router = createRouter({
    history: createWebHistory(),
    routes,
});

export default router;